package com.kai.rpc.provider.net;

import com.sun.org.apache.xerces.internal.dom.PSVIAttrNSImpl;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author kai
 * @date 2021/3/20 8:36
 * @description:
 */
public class NetServer {
    static final ExecutorService threadPool = Executors.newFixedThreadPool(10);



    public static void startUp(int port) throws Exception {
        ServerSocket serverSocket = new ServerSocket(port);

        while (true) {

            threadPool.submit(new RPCProcess(serverSocket.accept()));
        }
    }

    public static void main(String[] args) throws Exception {
        startUp(9999);
    }

}
